package com.irdstudio.tdp.console.api.rest;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import com.irdstudio.tdp.console.service.facade.OsrvArrangeVarService;
import com.irdstudio.tdp.console.service.vo.OsrvArrangeVarVO;
import com.irdstudio.sdk.beans.core.vo.ResponseData;
import com.irdstudio.sdk.beans.web.controller.AbstractController;

@RestController
@RequestMapping("/api")
public class OsrvArrangeVarController extends AbstractController  {
	
	@Autowired
	@Qualifier("osrvArrangeVarServiceImpl")
	private OsrvArrangeVarService osrvArrangeVarService;

	
	/**
	 * 列表数据查询
	 * @param page
	 * @param size
	 * @return
	 */
	@RequestMapping(value="/osrv/arrange/vars", method=RequestMethod.POST)
	public @ResponseBody ResponseData<List<OsrvArrangeVarVO>> queryOsrvArrangeVarAll(
			OsrvArrangeVarVO vo) {		
		List<OsrvArrangeVarVO> outputVo = osrvArrangeVarService.queryAllOwner(vo);
		return getResponseData(outputVo);
		
	}
	
	/**
	 * 根据主键查询详情
	 * @return
	 */
	@RequestMapping(value="/osrv/arrange/var/{appModelId}/{varId}", method=RequestMethod.GET)
	public @ResponseBody ResponseData<OsrvArrangeVarVO> queryByPk(@PathVariable("appModelId") String appModelId,@PathVariable("varId") String varId) {		
		OsrvArrangeVarVO inVo = new OsrvArrangeVarVO();
				inVo.setAppModelId(appModelId);
				inVo.setVarId(varId);
		OsrvArrangeVarVO outputVo = osrvArrangeVarService.queryByPk(inVo);
		return getResponseData(outputVo);
		
	}
	
	/**
	 * 根据主键删除信息
	 * @param osrvArrangeVar
	 * @return
	 */
	@RequestMapping(value="/osrv/arrange/var", method=RequestMethod.DELETE)
	public @ResponseBody ResponseData<Integer> deleteByPk(@RequestBody OsrvArrangeVarVO inOsrvArrangeVarVo) {		
		int outputVo = osrvArrangeVarService.deleteByPk(inOsrvArrangeVarVo);
		return getResponseData(outputVo);
		
	}
	
	/**
	 * 根据主键更新信息
	 * @param inOsrvArrangeVarVo
	 * @return
	 */
	@RequestMapping(value="/osrv/arrange/var", method=RequestMethod.PUT)
	public @ResponseBody ResponseData<Integer> updateByPk(@RequestBody OsrvArrangeVarVO inOsrvArrangeVarVo) {		
		int outputVo = osrvArrangeVarService.updateByPk(inOsrvArrangeVarVo);
		return getResponseData(outputVo);
		
	}
	
	/**
	 * 新增数据
	 * @param inOsrvArrangeVarVo
	 * @return
	 */
	@RequestMapping(value="/osrv/arrange/var", method=RequestMethod.POST)
	public @ResponseBody ResponseData<Integer> insertOsrvArrangeVar(@RequestBody OsrvArrangeVarVO inOsrvArrangeVarVo) {
		int outputVo = osrvArrangeVarService.insertOsrvArrangeVar(inOsrvArrangeVarVo);
		return getResponseData(outputVo);
		
	}
}
